package com.mongdb.mongdb;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.data.mongodb.core.mapping.Document;

import javax.persistence.Id;

import java.sql.Timestamp;
import java.util.Date;

/**
 * 指定对象插入的文档名称，默认类名
 */
@Document(MongController.COLLECTION)
public class User {
	/**
	 *
	 */
	private static final long serialVersionUID = 1L;

	public User() {

	}

	public User(Timestamp createTime) {
		this.createTime = createTime;
	}

	@Id
	private  String id;

	private String name;
	private String sex;

	@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
	private Timestamp createTime;

	public String getId() {
		return id;
	}

	public String getName() {
		return name;
	}

	public String getSex() {
		return sex;
	}

	public void setId(String id) {
		this.id = id;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	public Timestamp getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Timestamp createTime) {
		this.createTime = createTime;
	}

	@Override
	public String toString() {
		return "User{" +
				"id='" + id + '\'' +
				", name='" + name + '\'' +
				", sex='" + sex + '\'' +
				", createTime=" + createTime +
				'}';
	}
}
